package com.thon.dao.user.impl;


import java.util.List;

import org.springframework.stereotype.Repository;

import com.thon.dao.user.SendToDao;
import com.thon.dao.util.AbstractDao;
import com.thon.dao.util.Page;
import com.thon.entity.user.SendTo;

/**
 * @file SendToDaoImpl.java
 * @author wang
 * @date 2014年6月23日
 * @description TODO
 */
@Repository
public class SendToDaoImpl extends AbstractDao<SendTo> implements SendToDao{
	
	public SendToDaoImpl(){
		super(SendTo.class);
	}

	@Override
	public Page<SendTo> findAllSendTo(Page<SendTo> page, int id) {
		String queryString = "FROM SendTo s WHERE s.user.id = ? ";
		return findPage(page, queryString, id);
	}

	@Override
	public List<SendTo> listDefaultAddress(int uid, int isDefault) {
		String queryString = "FROM SendTo WHERE user.id = ? AND isDefault = ?";
		return findList(queryString, null, uid,isDefault);
	}

	@Override
	public List<SendTo> findSendtoList(int uid) {
		String queryString = "FROM SendTo WHERE user.id = ?";
		return findList(queryString, null, uid);
	}


}
